package com.ztf.exclusive;

/**
 * @projectName: javabase
 * @package: com.ztf.exclusive
 * @className: ExclusiveTest
 * @author: kevin
 * @description: TODO
 * @date: 2022/4/27 0027 15:51
 * @version: 1.0
 */
import java.util.HashMap;
import java.util.Map;

import org.activiti.engine.ProcessEngine;
import org.activiti.engine.ProcessEngines;
import org.junit.Test;

public class ExclusiveTest {
    @Test
    public void testDeploy(){
        //获取流程引擎
        ProcessEngine processEngine =  ProcessEngines.getDefaultProcessEngine();
        processEngine.getRepositoryService()
                .createDeployment()
                .addClasspathResource("com/itheima09/activiti5/exclusive/exclusive.bpmn")
                .deploy();
    }

    @Test
    public void testStartProcessInstance(){
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        processEngine.getRuntimeService()
                .startProcessInstanceById("exclusive:1:4304");
    }

    @Test
    public void testFinishTask(){
        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("message", "2");
        ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
        processEngine.getTaskService()
                .complete("4404",variables);
    }
}
